<?php

require_once("DataObject.php");
require_once("Department.php");
require_once("Section.php");
require_once("Term.php");
require_once("Course.php");
require_once("Professor.php");	
require_once("SectionSearch.php");
if(!openDatabase()){
  print "Database error.";
  print mysql_error();
//exit;
}
$rootPath="http://sga.gatech.edu/critique";


//The stuff below connects to the MySQL Database!
//I put all these database connection things into a function, but you don't have to. You can place the content of the function into the rest of the file.
//The process is as follows:
		//Connect to the server (the mysql_connect() line)
		//Select a database (mysql_select_db() does this)
//Make sure you always test the return values of these functions to detect errors!
function openDatabase() {
	$databaseName = "db49034_CourseCritique";
	//$databaseUserName="db49034_sga";
	//$databasePassword="gatech1885";
	$databaseName = "sga2";
	$databaseUserName="root";
	$databasePassword="";
        $databaseServer='localhost';
	//$databaseServer="internal-db.s49034.gridserver.com";
	if (mysql_connect($databaseServer,$databaseUserName,$databasePassword)) {
		//The mysql_connect() returns either the connection object, or FALSE on failure. so we can test to see if it's true (any value but false) or false (the else)		
		if (mysql_select_db($databaseName)) { //Tell it which database you want to use! if mysql_select_db() fails it will return false, so it'll skip to the "else"
			return true; //We'll use true to represent success
		} else {
			return false; //we'll use false to represent failure
		}
	} else {
		return false; //we'll use false to represent failure
	}
}


?>
